package com.pomr.service.equipmentreceive;

import java.util.List;
import java.util.Map;

import com.pomr.entity.EquipmentApc;
import com.pomr.entity.ReceiveEntity;
import com.pomr.entity.ReceiveParam;
import com.pomr.model.equipmentstorage.EquipmentStorage;
import com.pomr.model.equipmentstorage.EquipmentStorageDetail;
import com.pomr.model.equipmentstorage.MonitoringData;
import com.pomr.model.equipmentstorage.Receive;
import com.pomr.model.equipmentstorage.ReceiveRecipt;
import com.pomr.model.health.Option;
import com.pomr.model.health.PersonRecord;
import com.pomr.model.simstorage.SimStorageDetail;
import com.pomr.model.sys.FaultTreatment;
import com.pomr.model.sys.User;
import com.pomr.util.common.ResponseData;
import com.pomr.util.page.Page;

public interface ReceiveService {
	/**
	 * 通过身份证或姓名查询个人档案(本机构)
	 * @param rs
	 * @return
	 * @throws Exception
	 */
	public List<PersonRecord> searchRecords(String rs,User user) throws Exception;
	
	/**
	 * 查询本机构下可使用的所有设备信息
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public List<EquipmentStorageDetail> searchEquipments(User user) throws Exception;
	
	/**
	 * 查询本机构下已被领用的设备信息
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public List<EquipmentStorageDetail> searchEquipmentsUsed(User user) throws Exception;
	
	/**
	 * 查询本机构下可使用的所有SIM卡信息
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public List<SimStorageDetail> searchSims(User user) throws Exception;
	
	/**
	 * 领取设备
	 * @param user
	 * @param receive
	 * @return
	 * @throws Exception
	 */
	public int addReceive(User user,ReceiveEntity receiveEnt) throws Exception;
	
	public ReceiveRecipt searchReceipt(int id) throws Exception;
	/**
	 * 查询设备领用情况
	 * @param re
	 * @param eqid
	 * @param page
	 * @param limit
	 * @return
	 * @throws Exception
	 */
	public Page<List<Receive>> searchReceives(String re, String eqid, String page, String limit, User user) throws Exception;
	
	/**
	 * 查询设备领用详细信息(未归还)
	 * @param receive
	 * @return
	 * @throws Exception
	 */
	public Receive searchReceiveById(Receive receive) throws Exception;
	
	/**
	 * 归还设备
	 * @param id 
	 * @param isjb 1：解绑状态 3：绑定状态
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public boolean backReceiveById(String id, String isjb, User user) throws Exception;
	
	/**
	 * 更新设备领用信息
	 * @param receive
	 * @return
	 * @throws Exception
	 */
	public boolean editReceiveById(Receive receive) throws Exception;
	
	/**
	 * 获取定金
	 * @param sbid
	 * @param simid
	 * @return
	 * @throws Exception
	 */
	public double searchMonry(String sbid,String simid) throws Exception;
	
	/**
	 * 通过姓名或者身份证号获取档案
	 * @param name
	 * @param idcard
	 * @return
	 * @throws Exception
	 */
	public List<PersonRecord> searchRecords(String cond) throws Exception;
	
	/**
	 * 通过档案获取领用设备
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public List<EquipmentStorage> searchReceives(String id) throws Exception;
	
	/**
	 * 通过身份证号获取领用设备
	 * @param con
	 * @return
	 * @throws Exception
	 */
	public List<EquipmentStorage> searchReceivesByCon(String con) throws Exception;
	
	/**
	 * 通过领取记录获取监测值
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Option searchMonitors(String id,String pid,String time1,String time2) throws Exception;
	
	/**
	 * 通过设备id获取绑定的sim卡信息
	 * @param eid
	 * @return
	 * @throws Exception
	 */
	public SimStorageDetail seachBindSim(String eid) throws Exception;
	
	/**
	 * 通过sim卡id获取绑定的设备信息
	 * @param eid
	 * @return
	 * @throws Exception
	 */
	public EquipmentStorageDetail seachBindEquip(String eid) throws Exception;
	
	public Map<String, Object> searchBind(String type, User user) throws Exception;
	public SimStorageDetail searchSimByEqui(String eid) throws Exception;

	/**
	 * 获取本机构的设备绑定用户
	 * @param idcard
	 * @param page
	 * @param limit
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public Page<List<PersonRecord>> searchReceivePersons(String idcard, String page, String limit, User user) throws Exception;

	/**
	 * 获取用户绑定过的设备
	 * @param idcard
	 * @param page
	 * @param limit
	 * @return
	 * @throws Exception
	 */
	public Page<List<EquipmentStorage>> searchEquipByPerson(String idcard, String page, String limit) throws Exception;

	/**
	 * 获取用户设备监测数据
	 * @param eid 设备库存id
	 * @param idcard 身份证号
	 * @return
	 * @throws Exception
	 */
	public Option searchMonitorsByEquip(String eid, String idcard, String time1,String time2) throws Exception;

	/**
	 * 获取机构下的设备列表
	 * @param page
	 * @param limit
	 * @return
	 * @throws Exception
	 */
	public Page<List<EquipmentStorage>> searchEquipOfAgency(String page, String limit, User user) throws Exception;

	/**
	 * 获取设备领用的用户
	 * @param idcard
	 * @param page
	 * @param limit
	 * @return
	 * @throws Exception
	 */
	public Page<List<PersonRecord>> searchPersonsOfEquip(String idcard, String eid, String page, String limit) throws Exception;

	public SimStorageDetail searchSimDetail(String rid) throws Exception;

	/**
	 * 设备申领
	 * @param apc
	 * @return 1:申领成功 2 申领失败 3
	 * @throws Exception
	 */
	public int application(EquipmentApc apc) throws Exception;

	public ResponseData fault(FaultTreatment faultTreatment) throws Exception;

	public ResponseData searchfault(String receiveid) throws Exception;

	public ResponseData editfault(FaultTreatment faultTreatment) throws Exception;

	public ResponseData addReceive(User user, ReceiveParam receiveParam) throws Exception;
}
